import React from 'react';
import img from '../images/main.png';
import { hashHistory } from 'react-router';

let styles = {
    parentPanel: {
        textAlign: "left",
        height: "3rem",
        lineHeight: "3rem",
        fontSize: "1.1rem",
        color: "#fff",
        backgroundColor: "rgb(81, 91, 162)",
        paddingLeft: "3rem"
    },
    leftIcon: {
        position: "absolute",
        fontSize: "2rem",
        marginTop: "0.5rem",
        float: "left",
        left: "0.5rem",
        maxWidth: "2rem",
        maxHeight: "2rem"
    },
    rightSearchControl: {
        position: "absolute",
        right: "0rem",
        height: "1.5rem",
        width: "calc( 70% - 3.2rem )",
        top:"0.5rem"
    },
    rightReviewControl: {
        position: "absolute",
        right: "2rem",
        height: "1.5rem",
        width: "calc( 70% - 3.2rem )",
        top:"0.5rem"
    },
    searchIcon: {
        color: "#fff",
        position: "absolute",
        fontSize: "1.5rem",
        marginLeft:"0.2rem",
        right: "0.5rem"
    },
}

class NormalHeaderBar extends React.Component {

    render() {
        let _this = this;

        let image = img;
        
        if (this.props.img != undefined && this.props.img != "undefined") {
            image = this.props.img;
        }
        return (
            <div  style={styles.parentPanel}>
                <img style={styles.leftIcon} src={image}/>
                {this.props.toSearch && <div style={styles.rightSearchControl}><i onClick={()=>{hashHistory.push("searchpage/-1/1/0");}} className="fa fa-search" aria-hidden="true" style={styles.searchIcon}></i></div>}
                {sessionStorage.isReviewer=='1'&&this.props.showReview=='1'&&<div style={styles.rightReviewControl}><i onClick={()=>{hashHistory.push("approvalpage");}} className="fa fa-info-circle" aria-hidden="true" style={styles.searchIcon}></i></div>}
            </div>
        );
    }
}

export default NormalHeaderBar;